package com.zhanglifan.controller;

import com.zhanglifan.pojo.ItemCat;
import com.zhanglifan.service.ItemCatService;
import com.zhanglifan.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Information
 * Author: ZhangLifan
 * Time: 2017/11/6 0:29
 * Description:
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    private TestService testService;

    @Resource
    private ItemCatService itemCatService;

    @RequestMapping("/date")
    @ResponseBody
    public String test() {
        return testService.queryDate();
    }

    @RequestMapping("/itemcat/{pageNum}/{pageSize}")
    @ResponseBody
    public List<ItemCat> queryItemCatByPage(@PathVariable int pageNum, @PathVariable int pageSize) {
        List<ItemCat> itemCats = itemCatService.queryItemCatByPage(pageNum, pageSize);
        return itemCats;
    }
}
